<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateAuthsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
//        Schema::create('roles', function (Blueprint $table) {
//            $table->increments('id');
//            $table->string('name');
//            $table->string('label')->nullable();
//            $table->timestamps();
//        });
//
//        Schema::create('permissions', function (Blueprint $table) {
//            $table->increments('id');
//            $table->string('name');
//            $table->string('label')->nullable();
//            $table->timestamps();
//        });
//
//        Schema::create('permission_role', function (Blueprint $table) {
//            $table->integer('permission_id')->unsigned();
//            $table->integer('role_id')->unsigned();
//            $table->foreign('permission_id')
//                ->references('id')
//                ->on('permissions')
//                ->onDelete('cascade');
//            $table->foreign('role_id')
//                ->references('id')
//                ->on('roles')
//                ->onDelete('cascade');
//            $table->primary(['permission_Id', 'role_id']);
//        });
//
//        Schema::create('admin_role', function (Blueprint $table) {
//            $table->integer('role_id')->unsigned();
//            $table->integer('admin_id')->unsigned();
//            $table->foreign('role_id')
//                ->references('id')
//                ->on('roles')
//                ->onDelete('cascade');
//            $table->foreign('admin_id')
//                ->references('id')
//                ->on('admins')
//                ->onDelete('cascade');
//            $table->primary(['role_id', 'admin_id']);
//        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('roles');
        Schema::dropIfExists('permissions');
        Schema::dropIfExists('permission_role');
        Schema::dropIfExists('admin_role');
    }
}
